
import React, { Suspense ,lazy} from 'react';
import {Switch, Route,Redirect} from 'react-router-dom'
// 路由懒加载
const Login = lazy(() => import('@/views/Login'))
const Set = lazy(() => import('@/views/Set'))
const Order = lazy(() => import('@/views/Order'))
const Money = lazy(() => import('@/views/Money'))
const Number = lazy(() => import('@/views/Number'))
const Home = lazy(() => import('@/views/Home'))


const LoginRouter = () => {
        return (
            <Suspense fallback={<div>在加载中</div>}>
                <Switch>
                    <Route path="/login" component={Login} />
                </Switch>
            </Suspense>

        );
}
const SetRouter = () => {
    return (
        <Suspense fallback={<div>在加载中</div>}>
            <Switch>
                <Route path="/set" component={Set} />
            </Switch>
        </Suspense>

    );
}
const OrderRouter = () => {
    return (
        <Suspense fallback={<div>在加载中</div>}>
            <Switch>
                <Route path="/order" component={Order} />
            </Switch>
        </Suspense>

    );
}
const MoneyRouter = () => {
    return (
        <Suspense fallback={<div>在加载中</div>}>
            <Switch>
                <Route path="/money" component={Money} />
            </Switch>
        </Suspense>

    );
}
const NumberRouter = () => {
    return (
        <Suspense fallback={<div>在加载中</div>}>
            <Switch>
                <Route path="/number" component={Number} />
            </Switch>
        </Suspense>

    );
}
const HomeRouter = () => {
    return (
        <Suspense fallback={<div>在加载中</div>}>
            <Switch>
                <Route path="/Home" component={Home} />
            </Switch>
        </Suspense>

    );
}

export default [
    LoginRouter,
    SetRouter,
    HomeRouter,
    NumberRouter,
    MoneyRouter,
    OrderRouter
]


// export {
//     LoginRouter as default,
//     SetRouter,
//     HomeRouter,
//     NumberRouter,
//     MoneyRouter,
//     OrderRouter
// }